package org.jeik.data.dao;

import java.util.List;
import java.util.Map;

import org.jeik.data.models.Model;

public interface DAO {

	public int insert(Model model, Map<Integer, Object> params) throws DataException;

	public int update(Model model, List<String> keys, Map<Integer, Object> params) throws DataException;

	public int delete(Model model) throws DataException ;

	public void select(String tableName, String... fields) throws DataException;
	
	public void select(String tableName, List<String> fields) throws DataException;
	
	public void selectWhere(String tableName, List<String> fields, List<String> keys, Map<Integer,Object> params) throws DataException;
	
	public void selectCount(String tableName, List<String> fields) throws DataException;
	
	
	/**
	 *
	 * Executes a SQL statement that the user/developer provides.
	 * 
	 * @param stmt - database-dependent statement
	 * @throws DataException.
	 * 
	 */
	public void execute(String stmt) throws DataException;
	
	/**
	 * 
	 * @param params
	 * @param stmt
	 * @throws DataException
	 */
	public void executeQuery(Map<Integer, Object> params, String stmt) throws DataException;
	
	/**
	 *
	 * Executes an update SQL statement that the user/developer provides.
	 * 
	 * @param stmt - database-dependent update statement
	 * @throws DataException.
	 * 
	 */
	public int executeUpdate(String stmt) throws DataException;
	
	
	/**
	 * 
	 * @return Query execute result as list of DaoRecords. 
	 */
	public List<DaoRecord> getResult();
	
	
}
